package com.gosun.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class AlarmLogController {

    @Autowired
    private RedisTemplate<String, String> redisTemplate;

    @RequestMapping("/alarmLog/getIndex")
    @ResponseBody
    public String getIndex(@RequestParam String name,HttpServletRequest request){
        String sessionId=request.getSession(true).getId();
        redisTemplate.opsForValue().set(sessionId,name);
        return sessionId;
    }
}
